package com.sh.rabbitmq;

import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import com.sh.rabbitmq.utils.ChannelFactory;

public class Producer {

    public static final String QUEUE_NAME = "hello";

    public static void main(String[] args) throws Exception {
        Channel channel = ChannelFactory.getChannel();

        channel.queueDeclare(QUEUE_NAME, false, false, false, null);


        for (int i = 1; i <= 100; i++) {
            channel.basicPublish("", QUEUE_NAME, null, String.valueOf(i).getBytes());
            System.out.println(i);
        }
        System.out.println("发送成功");
    }
}
